﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.ShprossesBuilder.Modelling.Components;
using ITAP.Core.Modelling;

namespace ITAP.ShprossesBuilder.Modelling.Comparers
{
    class ShprossSelectedEndPointYAxisComparer : IComparer<Shpross>
    {
        #region IComparer<Shpross> Members

        public int Compare(Shpross x, Shpross y)
        {
            ModelPoint selectedXPoint = x.SelectedPointPosition;
            ModelPoint selectedYPoint = y.SelectedPointPosition;
            if (selectedXPoint != null && selectedYPoint != null)
            {
                if (selectedXPoint.Y < selectedYPoint.Y)
                    return -1;
                else if (selectedXPoint.Y == selectedYPoint.Y)
                    return 0;
                else
                    return 1;
            }
            else
                return -1;
        }

        #endregion
    }
}
